package ai.tubes.iris;

import ai.tubes.iris.helper.Utilities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class SplashScreenActivity extends Activity{
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);
		Thread timer = new Thread() {
			@Override
			public void run() {
				long startTime = System.currentTimeMillis();
				
				Utilities.initializeApps(SplashScreenActivity.this.getApplicationContext());
				
				long now = System.currentTimeMillis();
				if (now - startTime < Utilities.SPLASH_TIME){
					try {
						sleep(Utilities.SPLASH_TIME - (now - startTime));
					} catch (InterruptedException iEx){
						
					}
				}
				
				SplashScreenActivity.this.finish();
				startActivity(new Intent(SplashScreenActivity.this.getApplicationContext(), MainMenuActivity.class));
			}
		};
		
		timer.start();
	}
}
